package com.stegniy.primeNumbers;

import java.util.List;
import java.util.Scanner;
import java.util.concurrent.ExecutionException;

import static com.stegniy.primeNumbers.PrimeFinderCallable.generatePrimes;

public class Main {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        int numberOfThreads;
        long limitNumber;
        long start, finish;

        System.out.println("Please enter " +
                "number of threads and limit number " +
                "separated by space: ");

        Scanner scanner = new Scanner(System.in);
        numberOfThreads = scanner.nextInt();
        limitNumber = scanner.nextInt();

        start = System.currentTimeMillis();
        List<Long> list = generatePrimes(numberOfThreads, limitNumber);
        //System.out.println(list);
        finish = System.currentTimeMillis();
        System.out.print("Time = "+(finish-start)/1000.0 + " seconds");
        System.out.println(list.size());
    }
}
